home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CICA Windows Explosion!
/
The CICA Windows Explosion! - Disc 2.iso
/
nt
/
ntkb.zip
/
NTKB.EXE
/
Q111
/
8
/
55.TXT
< prev
Wrap
Text File
|
1994-03-01
|
5KB
|
107 lines
DOCUMENT:Q111855 28-FEB-1994 [W_NT]
TITLE :Maximum Number of Sockets an Application Can Use
PRODUCT :Windows NT
PROD/VER:3.10
OPER/SYS:WINDOWS
KEYWORDS:
--------------------------------------------------------------------------
The information in this article applies to:
- Microsoft Windows NT operating system version 3.1
- Microsoft Windows NT Advanced Server version 3.1
--------------------------------------------------------------------------
SUMMARY
=======
The maximum number of sockets supported by a particular Windows Sockets
supplier is implementation-specific. An application should make no
assumptions about the availability of a certain number of sockets.
MORE INFORMATION
================
Details of the Windows Sockets implementation are described in the WSAData
structure returned by WSAStartup() and defined as follows:
struct WSAData {
WORD wVersion;
WORD wHighVersion;
char szDescription[WSADESCRIPTION_LEN+1];
char szSystemStatus[WSASYSSTATUS_LEN+1];
unsigned short iMaxSockets;
unsigned short iMaxUdpDg;
char FAR * lpVendorInfo
};
On return from WSAStart() on Windows NT
iMaxSockets = 0x7fff (32767)
where iMaxSockets is the maximum number of sockets that a single process
can potentially open. A Windows Sockets implementation can provide a global
pool of sockets for allocation to any process, or it can allocate per-
process resources for sockets. The number can reflect the way in which the
Windows Sockets DLL or the networking software was configured. The number
can also be used when writing an application as an indication of whether
the Windows Sockets implementation can be used by the application.
For example, an X Windows server might check iMaxSockets when it starts. If
the number of sockets is less than 8, the application displays an error
message instructing the user to reconfigure the networking software. (This
is a situation in which the szSystemStatus text might be used.) There is no
guarantee that a particular application can actually allocate iMaxSockets
sockets, because there may be other Windows Sockets applications in use.
However, independent of the number of sockets supported by a particular
implementation is the issue of the maximum number of sockets that an
application can actually use.
The maximum number of sockets that a Windows Sockets application can use is
determined at compile time by the manifest constant FD_SETSIZE. To do this,
from the Win32 SDK WINSOCK.H file:
/*
* Select uses arrays of SOCKETs. These macros manipulate such
* arrays. FD_SETSIZE may be defined by the user before including
* this file, but the default here should be >= 64.
*
* CAVEAT IMPLEMENTOR and USER: THESE MACROS AND TYPES MUST BE
* INCLUDED IN WINSOCK.H EXACTLY AS SHOWN HERE.
*/
#ifndef FD_SETSIZE
#define FD_SETSIZE 64
#endif /* FD_SETSIZE */
This value is used in constructing the fd_set structures used in select().
The default value in WINSOCK.H is 64. If an application is designed to be
capable of working with more than 64 sockets, define the manifest
FD_SETSIZE in every source file before including WINSOCK.H. One way of
doing this is to include the definition within the compiler options in the
makefile, such as adding -DFD_SETSIZE=128 as an option to the compiler
command line for Microsoft C.
NOTE: Defining FD_SETSIZE as a particular value has no effect on the actual
number of sockets provided by a Windows Sockets implementation.
Additional reference words: 3.10
KBCategory:
KBSubCategory: tcpip netsrv
=============================================================================
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS
PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS
ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO
EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR
ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL,
CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF
MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION
OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES
SO THE FOREGOING LIMITATION MAY NOT APPLY.
Copyright Microsoft Corporation 1994.